package com.nuaa.militaryqa.service.impl;

import com.nuaa.militaryqa.bean.WeaponBigCategory;
import com.nuaa.militaryqa.mapper.WeaponDataMapper;
import com.nuaa.militaryqa.service.WeaponDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class WeaponDataServiceImpl implements WeaponDataService {

    @Autowired
    WeaponDataMapper weaponDataMapper;

    //向数据库中插入多个武器大类信息
    @Override
    public int insertWeaponBigCate(List<WeaponBigCategory> newRelation) {
        int insertCount = 0, insertRes = 0;
        for(WeaponBigCategory singleCategory : newRelation){
            insertRes = weaponDataMapper.insertWeaponBigCategory(singleCategory);
            if(insertRes != 0){
                insertCount ++;
            }
        }
        return insertCount;
    }
}
